@import '~antd/lib/style/themes/default.less';
@import '~antd/dist/antd.less';
@import './variables.less';

// Variables
@body-background: #eff2f7;

// Button
// --
@btn-default-color: @gray-8;
@btn-default-bg: @gray-2;
@btn-default-border: @gray-2;

.ant-btn.ant-btn {
  border: none;

  > .anticon {
    // Remove sturt
    display: inline-flex;
    justify-content: center;
    line-height: 0;
    height: 1em;
  }

  > .ant-btn-loading-icon .anticon {
    position: relative;
    z-index: 1;
    padding-right: 0;
    margin-right: 8px;
  }

  &:hover {
    color: @btn-default-color;
    border-color: @gray-2;
    background-color: @gray-3;
  }
  &-sm {
    height: 28px;
    line-height: 28px;
  }
  &-lg {
    height: 36px;
    padding: 0 20px;
  }
  &-primary {
    box-shadow: none;

    &:hover {
      background-color: @arcoblue-5;
      color: white;
    }
    &:active {
      background-color: @arcoblue-7;
      color: white;
    }
  }
}

// Icon
// --
.anticon {
  > svg {
    width: 1em;
    fill: currentColor;
  }
}

// Menu
// --
@menu-item-active-bg: @gray-2;
@menu-item-active-border-width: 0;

.ant-menu {
  &-inline,
  &-vertical {
    border-right: none;
  }

  &-item {
    transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1),
      background 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  }

  &-item-selected {
    border-radius: 2px;
    font-weight: bold;
  }
}

// Form
// ---
.ant-form-item {
  --margin-bottom: 20px;

  &:not(.ant-form-item-with-help) {
    margin-bottom: var(--margin-bottom);
  }

  &-label {
    > label {
      font-size: 13px;
      &::after {
        margin-right: 14px;
      }
    }
  }

  &-explain {
    min-height: var(--margin-bottom);
    line-height: var(--margin-bottom);
    font-size: 12px;
  }
}

// Input
// ---
.ant-input {
  &::placeholder {
    color: @gray-7;
  }
}

.ant-input,
.ant-input-affix-wrapper {
  border: 1px solid transparent;
  transition: color 0.1s linear, border-color 0.1s linear, background-color 0.1s linear;
  box-shadow: none !important;
  background-color: var(--gray2);
  color: var(--gray10);

  &:hover {
    background-color: var(--backgroundColorGray);
    border-color: transparent;
  }
  &:focus {
    border-color: var(--arcoblue6);
    background-color: white;
  }
  &-focused {
    border-color: var(--arcoblue6) !important;
    background-color: white !important;
  }

  .ant-input {
    background-color: transparent;
    color: var(--gray10);
  }
}

.ant-form-item-has-error {
  .ant-input,
  .ant-input-affix-wrapper {
    border-color: transparent;
    background-color: var(--backgroundColorError);

    &:hover {
      border-color: transparent;
      background-color: var(--backgroundColorErrorHover);
    }
    &:focus {
      border-color: @error-color;
      background-color: white;
    }
    &-focused {
      border-color: @error-color !important;
      background-color: white !important;
    }
  }
  .ant-input-group-addon {
    background-color: var(--backgroundColorError);
  }
}

.ant-input-group-addon {
  --border-color: var(--backgroundColorGray);

  background-color: var(--componentBackgroundColorGray);
  border-width: 0;

  &:first-child {
    border-right: 1px solid var(--border-color);
  }
  &:last-child {
    border-left: 1px solid var(--border-color);
  }
}

// Select
// ---
@select-background: var(--componentBackgroundColorGray);
@select-border-color: transparent;
@input-placeholder-color: var(--gray7);

.ant-select {
  &:not(.ant-select-disabled) {
    &:hover .ant-select-selector {
      border-color: transparent;
      background-color: var(--backgroundColorGray);
    }

    &.ant-select-focused .ant-select-selector.ant-select-selector.ant-select-selector {
      border-color: var(--primaryColor);
      box-shadow: none;
      background-color: transparent;
    }
  }

  &.ant-select-disabled {
    opacity: 0.5;
  }
}

// Date Picker
// --
@picker-bg:var (--componentBackgroundColorGray);
@picker-border-color: transparent;

// Drawer
// --
.ant-picker {
  background-color: var(--componentBackgroundColorGray);

  &:hover {
    border-color: transparent;
    background-color: var(--backgroundColorGray);
  }

  &.ant-picker-focused {
    background-color: transparent;
  }
}

// Upload
// --
.ant-upload {
  color: @dark-gray-1;
  overflow: hidden;

  &.ant-upload-drag.ant-upload-drag {
    border-color: transparent;
    background-color: @gray-2;
    background-clip: content-box;

    &:not(.ant-upload-disabled):hover {
      background-color: @arcoblue-1;

      .anticon-plus {
        color: @primary-color;
      }
    }

    .anticon-plus {
      display: block;
      padding: 20px 0 30px;
      font-size: 16px;
      color: @text-color;
    }
  }
}

.ant-form-item-has-error {
  .ant-upload.ant-upload-drag.ant-upload-drag:not(:hover) {
    border-color: transparent;
    background-color: var(--red1);
  }
}

// Breadcrumb
// ---
.ant-breadcrumb {
  > span:last-child {
    color: @text-color-strong;
    font-weight: 500;
  }
}

// Table
// ---
.ant-table-wrapper {
  width: 100%;
  max-width: 100%;
}

// Radio
// ---
.ant-radio-button-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  border: none !important;

  > .ant-radio-button {
    padding: 3px;
    border-radius: 6px;
    background-color: transparent;
    background-clip: content-box;
    transition: 0.3s ease-out var(--commonTiming);
  }

  &:focus-within {
    box-shadow: none;
  }
  &:hover {
    z-index: 1;
    color: var(--textColor);

    > .ant-radio-button {
      background-color: white;
    }
  }
  &-checked:not(.ant-radio-button-wrapper-disabled) {
    // Emphasize but not casue size change
    text-shadow: 0 0 var(--primaryColor);

    &:focus-within {
      box-shadow: none;
    }

    > .ant-radio-button {
      z-index: auto;
      background-color: white;

      & + * {
        position: relative;
      }
    }
  }
  &:not(:first-child)::before {
    content: none;
  }

  > .ant-radio-button {
    padding: 3px;
    border-radius: 6px;
    background-color: white;
    background-clip: content-box;
  }
}

// Picker
// ---
.ant-picker-footer {
  padding: 5px 15px;
}

// Switch
// ---
@keyframes spinWith50Translate {
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}
.ant-switch {
  &-loading-icon {
    animation-name: spinWith50Translate;
  }
}
